import request from '@/libs/request';

/**
 * @description 获取分类
 */
export function categoryList() {
    return request({
        url: '/dishes/category/list',
        method: 'get',
    });
}

/**
 * @description 新增分类
 */
export function addCategory(data) {
    return request({
        url: '/dishes/category/add',
        method: 'post',
        data
    })
}

/**
 * @description 删除分类
 */
export function deleteCategory(id) {
    return request({
        url: `/dishes/category/del/${id}`,
        method: 'delete'
    })
}

/**
 * @description 修改分类状态
 */
export function changeStatus(data) {
    return request({
        url: '/dishes/category/change',
        method: 'post',
        data
    })
}

/**
 * @description 修改分类
 */
export function editCategory(data) {
    return request({
        url: '/dishes/category/edit',
        method: 'post',
        data
    })
}


// ============================================
// 菜品接口
// ============================================

/**
 * @description 获取菜品
 */
export function getDishesList(data) {
    return request({
        url: '/dishes/dishes/list',
        method: 'get',
        params: data
    });
}

/**
 * @description 获取菜品
 */
export function addDishes(data) {
    return request({
        url: '/dishes/dishes/add',
        method: 'post',
        data
    });
}

/**
 * @description 删除菜品
 */
export function deleteDishes(id) {
    return request({
        url: `/dishes/dishes/del/${id}`,
        method: 'delete'
    });
}

/**
 * @description 编辑菜品
 */
export function editDishes(data) {
    return request({
        url: '/dishes/dishes/edit',
        method: 'post',
        data
    });
}

/**
 * @description 编辑菜品
 */
export function changeDishes(id, is_show) {
    return request({
        url: `/dishes/dishes/change/${id}/${is_show}`,
        method: 'put'
    });
}


